/**
  ******************************************************************************
  * @file    motor.h
  * @author  Amaseing team
  * @version V1.0.0
  * @date    21-november-2013
  * @brief   Motor 
  *         
  * <h2><center>&copy; COPYRIGHT 2013 W. Boerendans</center></h2>
  ******************************************************************************  
  */ 

#ifndef _MOTOR_H_
#define _MOTOR_H_

/* Includes ------------------------------------------------------------------*/
#include <stm32f4xx.h>

/* Public defines ------------------------------------------------------------*/
enum eDIRECTION {
	FORWARD = 0,
	BACKWARD
};

enum eDISTANCE {
	DIST1CM = 0,
	DIST2CM,
	DIST5CM,
	DIST10CM,
	DIST15CM
};

enum eTURN{
	TURN90L = 0,
	TURN90R,
	TURN180L,
	TURN180R,
	TURN270L,
	TURN270R,
	TURN360L, 
	TURN360R
};

/* Public functions ----------------------------------------------------------*/
// Init
void motorInit(void);

// Make a circle turn (MTx on break, MTy running) 
// Requires more space than motorPointTurn()!
void motorCirleTurn(enum eTURN turn);

// Make a point turn (narrow places, raster movement)
void motorPointTurn(enum eTURN turn);

// Drive x cm in a for- or backward direction
void motorDriveDistance(enum eDIRECTION dir,enum eDISTANCE dist);

// Sets the speeds of the left and right motor, for time duration.
// If time == -1, the motor will not stop moving.
void motorSetSpeed(int left, int right, int ms);

// Breaks the speed inmediately and set time 0
void motorBrake(void);

// Wait until driving is complete
void motorWaitWhileDriving(void);

// Returns: 1 when driving is complete
// 					0 when driving isn't complete
uint32_t motorDrivingDone(void);
#endif

